import request from '@/utils/request'

export function getSelect(params) {
    return request({
        url: window.CONFIG.restIp + '/sso/ews',
        headers: {
            'psecurity-target': 'select',
            'tenantId': readCookie('tenantId'),
            'userId': readCookie('userId')
        },
        method: 'post',
        data: params
    })
}
export function getProcessMessage(params) {
    return request({
        url: window.CONFIG.restIp + '/sso/ews',
        headers: {
            'psecurity-target': 'getProcessMessage',
            'tenantId': readCookie('tenantId'),
            'userId': readCookie('userId')
        },
        method: 'post',
        data: params
    })
}
export function processWorkOrder(params) {
    return request({
        url: window.CONFIG.restIp + '/sso/ews',
        headers: {
            'psecurity-target': 'processWorkOrder',
            'tenantId': readCookie('tenantId'),
            'userId': readCookie('userId')
        },
        method: 'post',
        data: params
    })
}

function readCookie(name) {
    var arr = document.cookie.match(new RegExp('(^| )' + name + '=([^;]*)(;|$)'))
    if (arr != null) return unescape(arr[2])
    return false
}
